package com.eqxiu.ieditor.api.impl.mall;

import java.util.List;

import com.eqxiu.ieditor.api.mall.IMallServiceApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.eqxiu.ieditor.api.mall.IMallHotWordServiceApi;
import com.eqxiu.ieditor.commons.dto.BaseResultData;
import com.eqxiu.ieditor.commons.web.ResultData;
import com.eqxiu.ieditor.dto.mall.HotWordInputDTO;
import eqxiu.mall.product.dto.HotWordDTO;

/**
 * @description 商城-热词service<br/>
 * 本类为重构后的结果，原代码写在HotwordController中
 * @author 
 * @modified DuYoulong 重构  
 * @creatTime 2019年4月3日
 * @since 1.0.0
 */
public class MallHotWordServiceApiImpl implements IMallHotWordServiceApi, BaseResultData {

	private final Logger logger = LoggerFactory.getLogger(MallHotWordServiceApiImpl.class);

	@Autowired
	private IMallServiceApi mallServiceApi;

	@Override
	public ResultData getHotWordList(HotWordInputDTO dto) {
		try {
			List<HotWordDTO> list = mallServiceApi.getMallHotWord(dto.getType());
			return success().setList(list);
		} catch (Exception e) {
			logger.error("根据类型获取热词列表异常={}", e);
			return fail();
		}
	}

}
